<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\captcha\Captcha;
$form = ActiveForm::begin();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>登录页面</title>
<link rel="stylesheet" href="css/style.default.css" type="text/css" />
<script type="text/javascript" src="js/plugins/jquery-1.7.min.js"></script>
<script type="text/javascript" src="js/plugins/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="js/plugins/jquery.cookie.js"></script>
<script type="text/javascript" src="js/plugins/jquery.uniform.min.js"></script>
<!--[if IE 9]>
    <link rel="stylesheet" media="screen" href="css/style.ie9.css"/>
<![endif]-->
<!--[if IE 8]>
    <link rel="stylesheet" media="screen" href="css/style.ie8.css"/>
<![endif]-->
<!--[if lt IE 9]>
    <script src="js/plugins/css3-mediaqueries.js"></script>
<![endif]-->
</head>
<style>
    .body{
        background: red;
    }
    .boxx{ 
    background-color: rgba(0,0,0,0);
 }
</style>
<body class="loginpage" style="background-image:url(image/1.jpg);">
    <div class="loginbox boxx">
        <div class="loginboxinner boxx">
            
            <div class="logo">
                <h1 class="logo">Seven.<span>Project</span></h1>
                <span class="slogan">后台管理系统</span>
            </div><!--logo-->
            
            <br clear="all" /><br />
            
            <div class="nousername">
                <div class="loginmsg">密码不正确.</div>
            </div><!--nousername-->
            
            <div class="nopassword">
                <div class="loginmsg">密码不正确.</div>
                <div class="loginf">
                    <div class="thumb"><img alt="" src="images/thumbs/avatar1.png" /></div>
                    <div class="userlogged">
                        <h4></h4>
                        <a href="index.html">Not <span></span>?</a> 
                    </div>
                </div><!--loginf-->
            </div><!--nopassword-->
            

                
                <div class="username">
                    <div class="usernameinner">
                        <input type="text" name="admin_user" id="admin_user" />
                    </div>
                </div>
                
                <div class="password">
                    <div class="passwordinner">
                        <input type="password" name="admin_pwd" id="admin_pwd" />
                    </div>
                    <?= $form->field($model, 'verifyCode', [
                            'options' => ['class' => 'form-group form-group-lg'],
                    ])->widget(Captcha::ClassName(),[
                           'captchaAction' => '/adminlogin/captcha',
                           'template' => "{image}",
                           'imageOptions' => ['alt' => '验证码','style'=>'cursor:pointer','title'=>'点击换图'],
                    ]); ?>
                </div>
                
                <button id="login">登录</button>
                
                <div class="keep"><input type="checkbox" name="remem_pw" /> <span style="color:black;">记住密码</span></div>
            

            
        </div><!--loginboxinner-->
    </div><!--loginbox-->


</body>
</html>

<script src="js/js/jquery.js"></script>
<script>
    $(function()
    {
        $("#adminmodel-verifycode-image").click(function()
            {
               $(this).hide();
            });
        $("#login").mouseover(function()
        {
            $(this).css({"cursor":"pointer"});
        })
        $("#login").click(function()
        {
            var admin_user=$("#admin_user").val();
            var admin_pwd=$("#admin_pwd").val();
            var remem_pw=$("input[name='remem_pw']").prop("checked")==true?1:0;
            if(admin_user && admin_pwd)
            {
                $.ajax({
                    type:'post',
                    async:false,
                    url:"index.php?admin/index",
                    dataType:'json',
                    data:{admin_user:admin_user,admin_pwd:admin_pwd,remem_pw:remem_pw},
                    success:function(data)
                    {
                        alert(data.msg);
                        if(data.error===0)
                        {
                           location.href='?r=admin%2Fdashboard'; 
                        }                   
                    }
                })
            }
            else
            {
                 alert('请填写用户名或密码');
            }   
        })
        // $(window).load(function(){
        // function fun()
        // {
        //     $('body').attr('style','background-image:url(image/2.jpg)');
        //       $("body").animate({ 
        //         background:"url(image/2.jpg)"
        //       }, 10000);
        // }
        // setInterval(fun(),10000);
        // // });
        
    })
</script>